<?php

require_once('init.php');

defined("IN_CA") or die();

require_once(CA_ROOT . 'config.php');
require_once(CA_KERNEL . 'MySqlWrapper.class.php');
require_once(CA_KERNEL . 'TemplateHandler.class.php');
require_once(CA_KERNEL . 'HookController.class.php');

$sql = new MySqlWrapper($config['hostname'], $config['username'], $config['password'], $config['database'], false);

$hc = new HookController();
$hc->registerHook("PAGE_LOAD");

define("CA_SCRIPT_ACCESS", "public");

$tplHead = new TemplateHandler(CA_SCRIPT_ACCESS . "_head.php");
$tplBody = new TemplateHandler(CA_SCRIPT_ACCESS . "_body.php");
$tplFoot = new TemplateHandler(CA_SCRIPT_ACCESS . "_foot.php");

$q = $sql->query("SELECT * FROM settings LIMIT 1");
$info = $sql->fetchArray($q, MYSQL_ASSOC);
$sql->freeResult($q);

$tplHead->assign("page_title", $info['site_title']);

$hc->initHooks();

$tplHead->display();
$tplBody->display();
$tplFoot->display();

?>